﻿

using OpenCvSharp;
using OpenCvSharp.Features2D;

using System;
using System.Collections.Generic;
using System.Net;

using Xc.DataAccess.CodeReader.Properties;
using Xc.DataAccess.Core;

namespace Xc.DataAccess.CodeReader.Models.Filters
{
    /// <summary>
    /// 绘制线条
    /// </summary>
   [Filter("绘制线条",FilterType.Draw)] 
    public class DrawLine : FilterBase
    {
        /// <summary>
        /// 起始点
        /// </summary>
        [InputParameter("起始点")]
        public CVPoint StartPoint { get; set; }=new CVPoint();
        /// <summary>
        /// 结束点
        /// </summary>
        [InputParameter("结束点")]
        public CVPoint EndPoint { get; set; }=new CVPoint();
        /// <summary>
        /// 颜色
        /// </summary>
        [InputParameter("颜色")]
        public Scalar Color { get; set; }
        /// <summary>
        /// 粗细
        /// </summary>
        [InputParameter("粗细")]
        public int Thickness { get; set; }
        /// <summary>
        /// 线条类型
        /// </summary>
        [InputParameter("线条类型")]
        public LineTypes LineTypes { get; set; }
        /// <summary>
        /// 偏移量
        /// </summary>
        [InputParameter("缩小值")]
        public int Shift { get; set; }
        internal override ResultData<Mat> UseChannel(Mat mat, FilterBase[] filterBases, FilterBase preFilterBase)
        {
            Cv2.Line(mat, StartPoint, EndPoint, Color, Thickness, LineTypes, Shift);
            return ResultData<Mat>.Accept(TextResource.drawing_line_success, mat);
        }
    }
}
